home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 9
/
The PC-SIG Library on CD ROM - Ninth Edition.iso
/
101_200
/
DISK0163
/
DISK0163.ZIP
/
INDE.C
< prev
next >
Wrap
Text File
|
1983-06-13
|
640b
|
35 lines
/* index and xindex for translit, and other programs */
/* find index of char c in string str */
index(str,c)
char c;
char str[];
{
int ind;
for(ind = 0; str[ind] != EOS ; ++ind)
if(str[ind] == c)
return(ind);
return(-1);
}
/* handle index specially for translit */
xindex(arr,c,allbut,lastto)
int c;
char arr[];
int allbut,lastto;
{
int index();
if(c == EOF)
return(-1);
else if(allbut == NO)
return(index(arr,(char) c));
else if(index(arr,(char) c)>-1)
return(-1);
else
return(lastto + 1);
}